<template>
  <view class="my-shop" :data-theme="theme()" :class="theme() || ''">
    <view class="my-shop-head">
      <view class="shop-head-info">
        <view class="d-s-s mb30">
          <image
            class="shop-logo"
            :src="shop_data.supplier.logoFilePath || '/static/shop-default.png'"
            mode="aspectFill"
          >
          </image>
          <view class="shop-info">
            <view class="d-b-c white f30 fb title mb10">
              {{ shop_data.supplier.name || "" }}
              <button class="btns" v-if="shop_data.supplier.isRecycle == 0">
                {{$t('user.normal_operation')}}
              </button>
              <button class="btns" v-else>{{$t('user.stop_operation')}}</button>
            </view>
            <view class="f24 white mb10"
              >{{$t('user.main_brand')}}{{ shop_data.supplier.categoryName || "" }}</view
            >
            <view class="d-s-c white f24">
              {{$t('user.join_time')}}{{ shop_data.supplier.createTime || "" }}
            </view>
          </view>
        </view>
      </view>
      <view> </view>
    </view>
    <view class="shop-data">
      <view class="shop-data-order">
        <view class="shop-data-head">
          <text class="f32 gray3 fb">{{$t('user.data_overview')}}</text>
          <!-- <text
            class="seller_center_body_order_head_more"
            @click="jumpPage('/pages/user/my_shop/my_shop_order?fill=1')"
            >{{$t('user.all_orders')}}<text class="icon iconfont icon-jiantou f24"></text
          ></text> -->
        </view>
        <view class="">
          <view class="shop-data-bottom">
            <view class="shop-data-bottom-item">
              <view class="f24 gray3 mb20">{{$t('user.total_withdrawals')}}({{$t('user.yuan')}})</view>
              <text class="f36 gray3 fb">{{
                shop_data.supplier.cashMoney
              }}</text>
            </view>
          </view>
          <view class="shop-data-bottom-b">
            <view class="shop-data-bottom-item">
              <view class="f24 gray3 mb20">{{$t('user.total_transactions')}}({{$t('user.transactions')}})</view>
              <text class="f36 gray3 fb">{{ shop_data.totalCount }}</text>
            </view>
            <view class="shop-data-bottom-item">
              <view class="f24 gray3 mb20">{{$t('user.today_transactions')}}({{$t('user.transactions')}})</view>
              <text class="f36 gray3 fb">{{ shop_data.todayCount }}</text>
            </view>
            <view class="shop-data-bottom-item">
              <view class="f24 gray3 mb20">{{$t('user.withdrawable')}}</view>
              <text class="f36 gray3 fb">{{ shop_data.supplier.money }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="shop-order">
        <view class="shop-data-head">
          <text class="f32 gray3 fb">{{$t('user.my_orders')}}</text>
          <text
            class="shop-data-head-more"
            @click="jumpPage('/pages/user/my_shop/my_shop_order?fill=1')"
            >{{$t('user.all')}}<text class="icon iconfont icon-jiantou f20"></text
          ></text>
        </view>
        <view class="shop-data-body d-b-c">
          <view
            class="d-c d-c-c"
            v-for="(item, index) in order_menu_list"
            :key="index"
            @click="jumpPage(item.url)"
          >
            <image :src="item.image" mode=""></image>
            <view class="f26 gray3">{{ item.title }}</view>
          </view>
        </view>
      </view>
      <view class="shop-menu">
        <view
          class="shop-menu-item"
          v-for="(item, index) in menu_list"
          :key="index"
          @click="jumpPage(item.url)"
        >
          <image class="image-icon" :src="item.image" mode=""></image>
          <view class="flex-1 f26 gray3">{{ item.title }}</view>
          <view class="menu-icon icon iconfont icon-jiantou"></view>
        </view>
        <view class="shop-menu-item" v-if="shop_data.supplier.status != 0">
          <image
            class="image-icon"
            src="/static/imgs/shop_07-33.png"
            mode=""
          ></image>
          <view class="flex-1 f26 gray3">{{$t('user.product_management')}}</view>
          <view class="menu-right">{{$t('user.unpaid_deposit')}}</view>
          <view class="menu-icon icon iconfont icon-jiantou"></view>
        </view>
        <view
          class="shop-menu-item"
          v-else
          @click="jumpPage('/pages/user/my_shop/pro_admin')"
        >
          <image
            class="image-icon"
            src="/static/imgs/shop_07-33.png"
            mode=""
          ></image>
          <view class="flex-1 f26 gray3">{{$t('user.product_management')}}</view>
          <view class="menu-icon icon iconfont icon-jiantou"></view>
        </view>
        <view
          class="shop-menu-item"
          @click="gotoPay(shop_data.supplier.status)"
        >
          <image
            class="image-icon"
            src="/static/imgs/shop_09.png"
            mode=""
          ></image>
          <view class="flex-1 f26 gray3">{{$t('user.merchant_deposit')}}</view>
          <view class="menu-right" v-if="shop_data.supplier.status == 0"
            >{{$t('user.paid')}}
          </view>
          <view class="menu-right" v-if="shop_data.supplier.status == 10"
            >{{$t('user.apply_exit')}}
          </view>
          <view class="menu-right" v-if="shop_data.supplier.status == 20"
            >{{$t('user.pay_now')}}
          </view>
          <view
            v-if="shop_data.supplier.status == 20"
            class="menu-icon icon iconfont icon-jiantou"
          ></view>
        </view>
        <!-- #ifdef APP -->
        <view v-if="is_open == 1" class="shop-menu-item" @click="toLive">
          <image
            class="image-icon"
            src="/static/imgs/shop_19.png"
            mode=""
          ></image>
          <view class="flex-1 f26 gray3">{{$t('user.my_live')}}</view>
          <view class="menu-icon icon iconfont icon-jiantou"></view>
        </view>
        <!-- #endif -->
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      order_menu_list: [
        {
          image: "/static/imgs/shop_03-15.png",
          title: this.$t('user.pending_payment'),
          url: "/pages/user/my_shop/my_shop_order?dataType=payment",
        },
        {
          image: "/static/imgs/shop_05.png",
          title: this.$t('user.pending_delivery'),
          url: "/pages/user/my_shop/my_shop_order?dataType=delivery",
        },
        {
          image: "/static/imgs/shop_08.png",
          title: this.$t('user.pending_receipt'),
          url: "/pages/user/my_shop/my_shop_order?dataType=received",
        },
        {
          image: "/static/imgs/shop_07.png",
          title: this.$t('user.after_sales'),
          url: "/pages/user/my_shop/after_sale?tianchong=1",
        },
      ],
      menu_list: [
        {
          image: "/static/imgs/shop_03-28.png",
          title: this.$t('user.merchant_home'),
          url: "/pages/shop/shop",
          title_right: "",
          right_icon: "",
        },
        {
          image: "/static/imgs/shop_05-30.png",
          title: this.$t('user.merchant_data'),
          url: "/pages/user/my_shop/my_shop_data",
          title_right: "",
          right_icon: "",
        },
        // {
        //   image: "/static/imgs/shop_07-33.png",
        //   title: "商品管理",
        //   url: "/pages/user/my_shop/my_shop_order?dataType=received",
        // },
        // {
        //   image: "/static/imgs/shop_09.png",
        //   title: "商品保证金",
        //   url: "/pages/user/my_shop/after_sale?tianchong=1",
        // },
        // {
        //   image: "/static/imgs/shop_16.png",
        //   title: "客服消息",
        //   url: "/pages/user/my_shop/after_sale?tianchong=1",
        // },
        // {
        //   image: "/static/imgs/shop_19.png",
        //   title: "我的直播",
        //   url: "/pages/user/my_shop/after_sale?tianchong=1",
        // },
      ],
      shop_data: {
        supplier: {},
      },
      user_id: "",
      shopSupplierId: "",
      is_open: 0,
      is_full: 0,
      msg_count: 0,
    };
  },
  onShow() {
    this.get_user_Data();
    this.get_shop_Data();
     uni.setNavigationBarTitle({
			title: this.$t('order.merchant_management')
		})
  },
  onLoad() {},
  methods: {
    jumpPage(path) {
      if (path.indexOf("?") != -1) {
        this.gotoPage(path + "&shopSupplierId=" + this.shopSupplierId);
      } else {
        this.gotoPage(path + "?shopSupplierId=" + this.shopSupplierId);
      }
    },
    // 获取用户数据
    get_user_Data() {
      let self = this;
      uni.showLoading({
        title: this.$t('user.loading'),
      });
      self._post("user/index/index", {}, function (res) {
        self.user_id = res.data.user.userId;
        self.shopSupplierId = res.data.supplierUser.shopSupplierId;
        console.log(res.data.supplierUser, "self.shopSupplierId");
        uni.hideLoading();
      });
    },
    // 获取店铺成交数据
    get_shop_Data() {
      let self = this;
      self._post("supplier/index/tradeData", {}, function (res) {
        self.shop_data = res.data;
        let supplier = self.shop_data.supplier;
        console.log(self.shop_data.supplier.cashMoney);
        self.is_open = res.data.isOpen;
        self.is_full = res.data.supplier.isFull;
        //self.msg_count = res.data.msg_count;
      });
    },
    goback() {
      uni.navigateBack();
    },
    // 支付保证金
    gotoPay(n) {
      if (n != 20) {
        return;
      }
      this.gotoPage("/pages/order/deposit-pay");
    },
    toLive() {
      let self = this;
      //if (this.is_full == 1) {
      this.gotoPage(
        "/pagesLive/my_live/my-live/my-live?shopSupplierId=" +
          self.shopSupplierId
      );
      /*} else {
					uni.showModal({
						title: this.$t('user.notification'),
						content: ''
					})
				}*/
    },
  },
};
</script>

<style lang="scss">
.btns {
  width: auto;
  height: 50rpx;
  background: #ffffff;
  border-radius: 25rpx;
  opacity: 0.85;
  font-weight: 400;
  font-size: 24rpx;
  color: #ff5704;
  @include font_color("font_color");
  line-height: 50rpx;
}

.shop-head-info {
  margin: 0 auto;
  position: relative;
  padding: 26rpx 18rpx 26rpx 22rpx;
  box-sizing: border-box;
  width: 750rpx;
  height: 223rpx;
  background: #ff5704;
  @include background_color("background_color");
}

.shop-logo {
  width: 102rpx;
  height: 102rpx;
  display: block;
  border-radius: 20rpx;
  margin-right: 20rpx;
}

.shop-info {
  flex: 1;
  box-sizing: border-box;
  padding-top: 10rpx;
}

.iconfont {
  font-size: 14px;
}

.my-shop {
}

.my-shop-head {
  width: 100%;
  padding-bottom: 19rpx;
}

.shop-data {
  position: relative;
  margin-top: -50rpx;
}

.shop-data-top {
  width: 100%;
  height: 200rpx;
}

.shop-data-bottom {
  width: 100%;
  padding-top: 12rpx;
  box-sizing: border-box;
  font-size: 26rpx;
  display: flex;
  font-weight: 400;
  justify-content: space-around;
  flex-direction: column;
  align-items: center;
}

.shop-data-bottom-b {
  width: 100%;
  padding-top: 34rpx;
  box-sizing: border-box;
  font-size: 26rpx;
  font-weight: 400;
  display: flex;
  justify-content: space-between;
  flex-direction: row;
  align-items: center;
}

.shop-data-bottom-item {
  color: #fff;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

/* 我的订单css */
.shop-data-order {
  width: 710rpx;
  height: 360rpx;
  background-color: white;
  margin: 0 auto;
  border-radius: 20rpx;
  padding: 22rpx;
  padding-bottom: 0;
  box-sizing: border-box;
  margin-top: -40rpx;
  margin-bottom: 24rpx;
}

.shop-order {
  width: 710rpx;
  background-color: white;
  margin: 0 auto;
  border-radius: 20rpx;
  padding: 30rpx 24rpx 30rpx 30rpx;
  margin-bottom: 22rpx;
  box-sizing: border-box;
}

.shop-menu {
  width: 710rpx;
  background-color: #fff;
  margin: 0 auto;
  border-radius: 25rpx;
  padding: 0 24rpx;
  box-sizing: border-box;
}

.shop-data-head {
  font-size: 30rpx;
  padding-bottom: 20rpx;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.shop-data-head-more {
  font-size: 24rpx;
  color: #666666;
  display: flex;
  align-items: center;
}

.shop-data-body {
  width: 100%;
  padding-top: 20rpx;
}

.shop-menu-item:last-child {
  border-bottom: none;
}

.shop-menu-item {
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 111rpx;

  .image-icon {
    width: 68rpx;
    height: 68rpx;
    margin-right: 26rpx;
  }
}

.shop-data-body image {
  width: 54rpx;
  height: 54rpx;
  margin: 0 auto;
  margin-bottom: 14rpx;
}

/* 订单css  END */
.menu-icon {
  display: inline-block;
  float: right;
  font-size: 24rpx;
}

.menu-right {
  display: inline-block;
  float: right;
  color: #d5d5d5;
  font-size: 24rpx;
  position: relative;
  margin-right: 5rpx;
}

.shop-data-head {
  .icon-jiantou.icon {
    font-size: 24rpx;
    color: #666;
    margin-left: 10rpx;
  }
}
</style>
